package ru.ifmo.rybakov.muclumon;

import java.util.Collection;

import javax.persistence.CascadeType;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

@Entity
@DiscriminatorValue("N")
public class Node extends Element {
	
	@ManyToOne
	@JoinColumn(name="parent_id", nullable = false)
	private Cluster cluster;
	
	@OneToMany(cascade = CascadeType.ALL, mappedBy = "node")
	private Collection<Core> cores;

	/**
	 * Returns the cluster
	 * @return The cluster
	 */
	public Cluster getCluster() {
		return cluster;
	}

	/**
	 * Sets the cluster value
	 * @param cluster The cluster to be set
	 */
	public void setCluster(Cluster cluster) {
		this.cluster = cluster;
	}

	/**
	 * @return the cores
	 */
	public Collection<Core> getCores() {
		return cores;
	}

	/**
	 * @param cores the cores to set
	 */
	public void setCores(Collection<Core> cores) {
		this.cores = cores;
	}
}
